import Vue from 'vue'
import Vuex from 'vuex'
import VuexPersistence from 'vuex-persist';//刷新保存状态
import { type } from 'os';
// import { start } from 'repl';

Vue.use(Vuex)
const vuexLocal = new VuexPersistence({//配置vuex-persist
    storage: window.sessionStorage
});


export default new Vuex.Store({
    state: {
        showBack: true,
        loading:{
            status:false,
            text:''
        }
    },
    mutations: {
        updateLoading(state, status) {
            state.loading.status = status.status;
            state.loading.text = status.text;
        },
        updateShowBack(state, showBack) {
            state.showBack = showBack
        },
        updateTitle(state, title) {
            state.title = title
        },
        showname(state){
            alert(state.user_name)
        }
    },
    actions:{
        startLoading({state,commit},status){
            commit('updateLoading',status)
        }
    }
    // plugins: [vuexLocal.plugin]
})
